package com.yxjx.duoxue.datamodel.config;

import org.json.JSONException;
import org.json.JSONObject;

import com.yxjx.duoxue.utils.UIHelper;

public class ConfigRefundTypeDTS implements java.io.Serializable {

    /**
	 * 
	 */
	private static final long serialVersionUID = -492638213147886559L;
	private Integer id;
    private String typeName;
    private String typeDes;
    private Integer typeStatus;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public String getTypeDes() {
        return typeDes;
    }

    public void setTypeDes(String typeDes) {
        this.typeDes = typeDes;
    }

    public Integer getTypeStatus() {
        return typeStatus;
    }

    public void setTypeStatus(Integer typeStatus) {
        this.typeStatus = typeStatus;
    }

    @Override
    public String toString() {
        return "{\"id\":\"" + id + "\", \"typeName\":\"" + typeName + "\", \"typeDes\":\"" + typeDes + "\", \"typeStatus\":\"" + typeStatus + "\"}";
    }
    
    public static ConfigRefundTypeDTS from(String str) {
    	if (UIHelper.isEmpty(str)) {
    		return null;
    	}
    	
    	try {
			JSONObject jo = new JSONObject(str);
			ConfigRefundTypeDTS type = new ConfigRefundTypeDTS();
			type.setId((Integer) jo.get("id"));
		    type.setTypeName((String) jo.get("typeName"));
		    type.setTypeDes((String) jo.get("typeDes"));
		    type.setTypeStatus((Integer) jo.get("typeStatus"));
			return type;
		} catch (JSONException e) {
			e.printStackTrace();
		}
    	
    	return null;
    }

}